package cn.selfiot.iotman.model.mqtt;

import cn.selfiot.iotman.model.mqtt.messge.PublishMessageModel;
import cn.selfiot.iotman.model.mqtt.messge.SubscribeTopicModel;

import java.util.List;

/**
 * Mqtt Project 对象模型
 *
 * @author hugo
 * @since 2020/8/2
 */
public class ProjectModel {
    private String id;
    private String projectType = "mqtt";
    private String projectName;
    private String hostAddr;
    private Integer hostPort = 1883;
    private String clientId;
    private ConnParamsModel connParams;
    private UserPwdAuthModel userPwdAuth;
    private LwtModel lwt;
    private SSLModel ssl;
    private List<TopicModel> topics;
    private List<PublishMessageModel> publishMessages;
    private List<SubscribeTopicModel> subscribeTopics;
    
    public String getId() {
        return id;
    }
    
    public void setId(String id) {
        this.id = id;
    }
    
    public String getProjectType() {
        return projectType;
    }
    
    public void setProjectType(String projectType) {
        this.projectType = projectType;
    }
    
    public String getProjectName() {
        return projectName;
    }
    
    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }
    
    public String getHostAddr() {
        return hostAddr;
    }
    
    public void setHostAddr(String hostAddr) {
        this.hostAddr = hostAddr;
    }
    
    public Integer getHostPort() {
        return hostPort;
    }
    
    public void setHostPort(Integer hostPort) {
        this.hostPort = hostPort;
    }
    
    public String getClientId() {
        return clientId;
    }
    
    public void setClientId(String clientId) {
        this.clientId = clientId;
    }
    
    public ConnParamsModel getConnParams() {
        return connParams;
    }
    
    public void setConnParams(ConnParamsModel connParams) {
        this.connParams = connParams;
    }
    
    public UserPwdAuthModel getUserPwdAuth() {
        return userPwdAuth;
    }
    
    public void setUserPwdAuth(UserPwdAuthModel userPwdAuth) {
        this.userPwdAuth = userPwdAuth;
    }
    
    public LwtModel getLwt() {
        return lwt;
    }
    
    public void setLwt(LwtModel lwt) {
        this.lwt = lwt;
    }
    
    public SSLModel getSsl() {
        return ssl;
    }
    
    public void setSsl(SSLModel ssl) {
        this.ssl = ssl;
    }
    
    public List<TopicModel> getTopics() {
        return topics;
    }
    
    public void setTopics(List<TopicModel> topics) {
        this.topics = topics;
    }
    
    public List<PublishMessageModel> getPublishMessages() {
        return publishMessages;
    }
    
    public void setPublishMessages(List<PublishMessageModel> publishMessages) {
        this.publishMessages = publishMessages;
    }
    
    public List<SubscribeTopicModel> getSubscribeTopics() {
        return subscribeTopics;
    }
    
    public void setSubscribeTopics(List<SubscribeTopicModel> subscribeTopics) {
        this.subscribeTopics = subscribeTopics;
    }
    
    @Override
    public String toString() {
        return "ProjectModel{" +
                "id=" + id +
                ", projectType='" + projectType + '\'' +
                ", projectName='" + projectName + '\'' +
                ", hostAddr='" + hostAddr + '\'' +
                ", hostPort=" + hostPort +
                ", clientId='" + clientId + '\'' +
                ", connParams=" + connParams +
                ", userPwdAuth=" + userPwdAuth +
                ", lwt=" + lwt +
                ", ssl=" + ssl +
                ", topics=" + topics +
                ", publishMessages=" + publishMessages +
                ", subscribeTopics=" + subscribeTopics +
                '}';
    }
    
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ProjectModel)) return false;
        
        ProjectModel that = (ProjectModel) o;
        
        if (getId() != null ? !getId().equals(that.getId()) : that.getId() != null) return false;
        if (getProjectType() != null ? !getProjectType().equals(that.getProjectType()) : that.getProjectType() != null)
            return false;
        if (getProjectName() != null ? !getProjectName().equals(that.getProjectName()) : that.getProjectName() != null)
            return false;
        if (getHostAddr() != null ? !getHostAddr().equals(that.getHostAddr()) : that.getHostAddr() != null)
            return false;
        if (getHostPort() != null ? !getHostPort().equals(that.getHostPort()) : that.getHostPort() != null)
            return false;
        if (getClientId() != null ? !getClientId().equals(that.getClientId()) : that.getClientId() != null)
            return false;
        if (getConnParams() != null ? !getConnParams().equals(that.getConnParams()) : that.getConnParams() != null)
            return false;
        if (getUserPwdAuth() != null ? !getUserPwdAuth().equals(that.getUserPwdAuth()) : that.getUserPwdAuth() != null)
            return false;
        if (getLwt() != null ? !getLwt().equals(that.getLwt()) : that.getLwt() != null) return false;
        if (getSsl() != null ? !getSsl().equals(that.getSsl()) : that.getSsl() != null) return false;
        if (getTopics() != null ? !getTopics().equals(that.getTopics()) : that.getTopics() != null) return false;
        if (getPublishMessages() != null ? !getPublishMessages().equals(that.getPublishMessages()) : that.getPublishMessages() != null)
            return false;
        return getSubscribeTopics() != null ? getSubscribeTopics().equals(that.getSubscribeTopics()) : that.getSubscribeTopics() == null;
    }
    
    @Override
    public int hashCode() {
        int result = getId() != null ? getId().hashCode() : 0;
        result = 31 * result + (getProjectType() != null ? getProjectType().hashCode() : 0);
        result = 31 * result + (getProjectName() != null ? getProjectName().hashCode() : 0);
        result = 31 * result + (getHostAddr() != null ? getHostAddr().hashCode() : 0);
        result = 31 * result + (getHostPort() != null ? getHostPort().hashCode() : 0);
        result = 31 * result + (getClientId() != null ? getClientId().hashCode() : 0);
        result = 31 * result + (getConnParams() != null ? getConnParams().hashCode() : 0);
        result = 31 * result + (getUserPwdAuth() != null ? getUserPwdAuth().hashCode() : 0);
        result = 31 * result + (getLwt() != null ? getLwt().hashCode() : 0);
        result = 31 * result + (getSsl() != null ? getSsl().hashCode() : 0);
        result = 31 * result + (getTopics() != null ? getTopics().hashCode() : 0);
        result = 31 * result + (getPublishMessages() != null ? getPublishMessages().hashCode() : 0);
        result = 31 * result + (getSubscribeTopics() != null ? getSubscribeTopics().hashCode() : 0);
        return result;
    }
}
